#!/bin/bash

# 用户数量（假设要删除10个用户）
count=1

# 用户名前缀
username_prefix="user"

# 删除用户
while [ $count -le 10 ]  # 假设要删除user1到user10
do
  # 创建用户名
  username="${username_prefix}${count}"

  # 检查用户是否存在
  if id "$username" &>/dev/null; then
    # 用户存在，执行删除
    userdel "$username"
    echo "User $username deleted successfully."
  else
    # 用户不存在
    echo "User $username does not exist."
  fi

  # 计数器递增
  ((count++))
done

echo "User deletion process completed."
